package world.square;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import world.placement.Direction;

public class TeleportationTest {

	NormalTeleport normalSquare;
    TransparentTeleport transparantSquare;
    Square square;
    Rock rockSquare;
    
    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
            square = new Square();
            List <Square> list = new ArrayList <Square>();
            list.add(square);
            normalSquare = new NormalTeleport(list,Direction.NORTH);
            transparantSquare =  new TransparentTeleport(list);
    }

    @After
    public void tearDown() throws Exception {
    }

    
    @Test
    public final void isValidDestination_TrueCase(){
            assertTrue(transparantSquare.isValidDestination(square));
    }
    
    @Test
    public final void isValidDestination_FalseCase(){
            assertFalse(transparantSquare.isValidDestination(null));
            assertFalse(transparantSquare.isValidDestination(rockSquare));
    }
    
    @Test
    public final void setRockDestination_SingleCase(){
            normalSquare.addDestination(rockSquare);
            assertEquals(2, normalSquare.getDestinations().size());
    }
    
    @Test
    public final void addDestinations(){
            Square newSquare = new Square();
            normalSquare.addDestination(newSquare);
            assertEquals(2, normalSquare.getDestinations().size());
    }
    
    @Test
    public final void randomDestination_OneDestination(){
            assertEquals(square, normalSquare.randomDestination());
    }
    
    

}
